﻿
namespace MyFloridaHouse.libSvOpenDistricts.ViewModel
{
    public partial class ViewModelBase
    {
        #region properties
        private bool _isRightMenuVisible = true;
        public bool isRightMenuVisible
        {
            get { return _isRightMenuVisible; }
            set
            {
                if (_isRightMenuVisible != value)
                {
                    _isRightMenuVisible = value;
                    NotifyPropertyChanged("isRightMenuVisible");
                    NotifyPropertyChanged("rightMenuCommandLabel");
                }
            }
        }

        public string rightMenuCommandLabel
        {
            get
            {
                if (isRightMenuVisible)
                {
                    return ">>";
                }
                else
                {
                    return "<<";
                }
            }
        }

        private double _rightMenuColumnWidth = 0.0;
        public double rightMenuColumnWidth
        {
            get
            {
                if (isRightMenuVisible)
                {
                    return _rightMenuColumnWidth;
                }
                else
                {
                    NotifyPropertyChanged("saveRightMenuColumnWidth");
                    return 0;
                }
            }
            set
            {
                // don't raise property changed, cause that will cause an infinite loop
                _rightMenuColumnWidth = value;
            }

        }

        #endregion        #endregion

        #region Commands
        private bool CmdToggleShowRightMenuCanExecute(object parameter)
        {
            return true;
        }

        private void CmdToggleShowRightMenuExecute(object parameter)
        {
            if (isRightMenuVisible)
            {
                isRightMenuVisible = false;
            }
            else
            {
                isRightMenuVisible = true;
            }
        }
        #endregion

    }
}
